More robustness improvements of the parser
authorMatthias Clasen <matthiasc@src.gnome.org>
Sat, 10 Nov 2007 04:50:15 +0000 (04:50 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Sat, 10 Nov 2007 04:50:15 +0000 (04:50 +0000)
svn path=/trunk/; revision=18978

ChangeLog
gtk/gtkbuilderparser.c

index 8384acf37df817f7c7a21bf1c4ae7f3db2a3c09e..700d68e2e6ff2afe28c0d25c87c8f47e870c3f68 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2007-11-09  Matthias Clasen  <mclasen@redhat.com>
        
+       * gtk/gtkbuilderparser.c: More robustness improvements
+       for the parser.
+
        * gtk/gtkbuilderparser.c (parse_signal): Handle misplaced
        signal elements without asserting.
 
index 56acdc26133c3ee7889ba0ee3e133c5120a091b2..ee66b8d2dcc5db2ff9facf1fc35e17dd27e2b4de 100644 (file)
@@ -244,8 +244,6 @@ parse_object (ParserData   *data,
   if (child_info && strcmp (child_info->tag.name, "object") == 0)
     {
       error_invalid_tag (data, element_name, NULL, error);
-      if (child_info)
-       free_object_info ((ObjectInfo*)child_info);
       return;
     }
 
@@ -332,9 +330,7 @@ parse_child (ParserData   *data,
   object_info = state_peek_info (data, ObjectInfo);
   if (!object_info || strcmp (object_info->tag.name, "object") != 0)
     {
-      error_invalid_tag (data, element_name, "object", error);
-      if (object_info)
-       free_object_info (object_info);
+      error_invalid_tag (data, element_name, NULL, error);
       return;
     }
   
@@ -375,11 +371,13 @@ parse_property (ParserData   *data,
   gchar *name = NULL;
   gchar *context = NULL;
   gboolean translatable = FALSE;
+  ObjectInfo *object_info;
   int i;
 
-  if (data->stack == NULL) 
+  object_info = state_peek_info (data, ObjectInfo);
+  if (!object_info || strcmp (object_info->tag.name, "object") != 0)
     {
-      error_invalid_tag (data, "property", NULL, error);
+      error_invalid_tag (data, element_name, NULL, error);
       return;
     }
 
@@ -446,11 +444,13 @@ parse_signal (ParserData   *data,
   gboolean after = FALSE;
   gboolean swapped = FALSE;
   gboolean swapped_set = FALSE;
+  ObjectInfo *object_info;
   int i;
 
-  if (data->stack == NULL)
+  object_info = state_peek_info (data, ObjectInfo);
+  if (!object_info || strcmp (object_info->tag.name, "object") != 0)
     {
-      error_invalid_tag (data, "signal", NULL, error);
+      error_invalid_tag (data, element_name, NULL, error);
       return;
     }